package IO;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;

import javax.swing.JOptionPane;

import javab.Logs;


public class MyIoper {
	
	//序列化保存
	public void serSave(String path ,ArrayList<Logs> arlist) {
		System.out.println(arlist.get(0).getId());
		System.out.println(arlist.size());
		try {
			ObjectOutputStream ous=new ObjectOutputStream(new FileOutputStream(path));
			for(Logs s:arlist) {
				ous.writeObject(s);
			}
			ous.close();
			JOptionPane.showMessageDialog(null, "保存成功");
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
//			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "文件保存失败");
		}
		
		
	}
	
	
	
}
